<!DOCTYPE html>
<html lang="en" ng-app>
<head>
    <meta charset="UTF-8">
    <title>FormAdv1</title>
    <script type="text/javascript" src="../libs/angular-1.3.0.14/angular.js"></script>
    <script type="text/javascript" src="./js/FormAdv1.js"></script>
</head>
<body>
    <div ng-controller="Controller">
        <form name="form" class="css-form" novalidate>
            Name:
            <input type="text" ng-model="user.name" name="uName" required><br>
            E-mail:
            <input type="email" ng-model="user.email" name="uEmail" required><br>
            <div ng-show="form.uEmail.$dirty && form.uEmail.$invalid">
                Invalid:
                <span ng-show="form.uEmail.$error.required">Tell us your email.</span>
                <span ng-show="form.uEmail.$error.email">This is not a valid email.</span>
            </div>
            Gender:<br>
            <input type="radio" ng-model="user.gender" value="male">
            male
            <input type="radio" ng-model="user.gender" value="female">
            female<br>
            <input type="checkbox" ng-model="user.agree" name="userAgree" required>
            I agree:
            <input type="text" ng-show="user.agree" ng-model="user.agreeSign" required>
            <div ng-show="!user.agree || !user.agreeSign">
                Please agree and sign.
            </div><br>
            <button ng-click="reset()" ng-disabled="isUnchanged(user)">
                RESET
            </button>
            <button ng-click="update(user)" ng-disabled="form.$invalid || isUnchanged(user)">
                SAVE
            </button>
        </form>
    </div>
</body>
</html>